package com.qf.config;


import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class MyConfig {
//    创建声明了一个 队列
    @Bean
    public Queue queue(){
        return new Queue("wangzong");
    }
//   创建声明了一个交换机
    @Bean
    public FanoutExchange fanoutExchange(){
      return   new FanoutExchange("nazhejingzi");
    }
//   绑定交换机
    @Bean
    public Binding binding(Queue queue, FanoutExchange fanoutExchange){
       return  BindingBuilder.bind(queue).to(fanoutExchange);
    }
}
